/**
 * Copyright(c) 2010 Ceno Techonologies Co., Ltd.
 *
 * History:
 *   15-6-4 下午5:33 Created by lyyang
 */
package com.xunton.bss.weixin.api.message.event.listener;

import javax.ejb.TransactionAttribute;
import javax.inject.Inject;
import javax.inject.Named;

import com.xunton.bss.weixin.api.message.event.Event;
import com.xunton.bss.weixin.api.message.event.EventDao;
import com.xunton.bss.weixin.api.message.event.Listener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.transaction.annotation.Transactional;

/**
 * 微信推送事件
 *
 * @author <a href="mailto:lyyang@ceno.cn">lyyang</a>
 * @version 1.0 15-6-4 下午5:33
 */
public class SimpleEventListener implements Listener
{
    protected Log logger = LogFactory.getLog(this.getClass());

    private EventDao eventDao;

    @Inject
    public void setEventDao(@Named ("weixin_eventDao") EventDao eventDao)
    {
        this.eventDao = eventDao;
    }

    @TransactionAttribute
    @Transactional (rollbackFor = Exception.class)
    public void process(Event event)
            throws Exception
    {
        eventDao.save(event);
    }
}
